///////////////////////////////////////////////////////////////////////////////
//
// Licensed under the MIT License
//
// Copyright (c) 2010 Chris Colinsky
// All Rights Reserved
//
// version	0.5
// http://code.google.com/p/sugarcookie/
// http://code.google.com/p/sugarcookie/wiki/License
//
////////////////////////////////////////////////////////////////////////////////

package sugarcookie.commands {
	import flash.net.FileReference;
	
	import mx.logging.ILogger;
	import mx.logging.Log;
	
	import sugarcookie.browser.Link;
	import sugarcookie.error.ApplicationError;
	
	public class LinkCommand implements ICommand {
		private var _link:Object;
		private var _log:ILogger;
		private var _file:FileReference;
		
		public function LinkCommand(link:Object=null) {
			_log = Log.getLogger("sugarcookie.commands.LinkCommand");
			_link = link;
		}
		
		public function set link(value:Object):void {
			_link = value;
		}
		
		public function execute():void {
			if (_link==null) throw new ApplicationError("Link object has not been defined!");
			Link.execute(_link);
		}
		
		public function clone():ICommand {
			return new LinkCommand(_link);
		}
	}
}